package com.freemarker;

import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.HashMap;
import java.util.Map;

import freemarker.template.Configuration;
import freemarker.template.Template;

public class FreemarkTest1 {
	private Configuration cfg;

	public Configuration getCfg() {
		return cfg;
	}

	public void init() throws Exception {
		cfg = new Configuration();
		//cfg.setDirectoryForTemplateLoading(new File("bin/freemarker"));
	}

	public static void main(String[] args) throws Exception {
		FreemarkTest1 obj = new FreemarkTest1();
		obj.init();
		Map root = new HashMap();
		Template t = obj.getCfg().getTemplate("resources/FreemarkTest1.ftl");
		//Writer out = new OutputStreamWriter(new FileOutputStream("Test1.html"), "GBK");
		Writer out = new OutputStreamWriter(System.out, "GBK");
		t.process(root, out);
		System.out.println("Successfull................");
	}
}